package com.leejxx.utils.common;

import com.leejxx.model.user.pojos.ApUser;

/**
 * @Author LeeJx
 * @ClassName AppThreadLocalUtils
 * @Description TODO
 * @date 2021/3/3 14:05
 * @Version 1.0
 */
public class AppThreadLocalUtils {
    private final  static ThreadLocal<ApUser> userThreadLocal = new ThreadLocal<>();

    /**
     * 设置当前线程中的用户
     * @param user
     */
    public static void setUser(ApUser user){
        userThreadLocal.set(user);
    }

    /**
     * 获取线程中的用户
     * @return
     */
    public static ApUser getUser( ){
        return userThreadLocal.get();
    }
}
